<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        //$this->view->headMeta()->appendHttpEquiv('Refresh','5;URL='.Zend_Controller_Front::getInstance()->getBaseUrl().'/index/index');


        $shell=new Application_Model_Shell();

        $cmd="sysinfo.sh";
        $lines=array();
        $retcode=0;

        $shell->  executeCmd($cmd, $lines, $retcode);

        //$this->view->cpu_cores=$lines[0];
        //$this->view->cpu_model=$lines[1];
        //$this->view->ram_total=$lines[2];
        //$this->view->ram_free=$lines[3];
        //$this->view->swap_total=$lines[4];
        //$this->view->swap_free=$lines[5];
        //$this->view->host_name=$lines[6];
        //$this->view->os_type=$lines[7];
        //$this->view->arch=$lines[8];
        //$this->view->kernel=$lines[9];
        //$this->view->server_time=$lines[10];

        $sysinfo=array();
        $resourceinfo=array();

        $sysinfo[0]=explode('==',$lines[10]);
        $sysinfo[1]=explode('==',$lines[6]);
        $sysinfo[2]=explode('==',$lines[7]);
        $sysinfo[3]=explode('==',$lines[9]);
        $sysinfo[4]=explode('==',$lines[8]);

        $resourceinfo[0]=explode('==',$lines[1]);
        $resourceinfo[1]=explode('==',$lines[0]);
        $resourceinfo[2]=explode('==',$lines[2]);
        $resourceinfo[3]=explode('==',$lines[3]);
        $resourceinfo[4]=explode('==',$lines[4]);
        $resourceinfo[5]=explode('==',$lines[5]);
        $resourceinfo[6]=explode('==',$lines[11]);

        $this->view->sysinfo=$sysinfo;
        $this->view->resourceinfo=$resourceinfo;
    }

    public function testAction()
    {
        // action body
    }
}



